{if $action!="edit" && $action!="new"}
{if $numcontent > 0}
{literal}
  <script type="text/javascript">
<!--
function confirmDelete(articleId) {
if (confirm("This will delete this page. Continue?"))
  {/literal}
document.location = "{$pagename}&action=delete&id=" + articleId;
{literal}
}
//-->
</script>
  {/literal}
<h2>Static Content Pages</h2>
<div align="left"><input type="button" class="button" value="New Page" onclick="window.location='{$pagename}&amp;action=new';" /></div>
<table width="100%" border="0" cellspacing="1" cellpadding="4" align="center" class="table">
  <tr valign="top"> 
    <th width="10%" class="smallhead">Action</th>
    <th width="15%" class="smallhead">Name</th>
    <th width="75%" class="smallhead">Summary</th>
  </tr>
 {section name=contentloop loop=$numcontent}
	  <tr valign="middle"> 
		<td class="text"><a href="{$pagename}&amp;id={$content[contentloop].id}&amp;action=edit"><img src="{$tempdir}admin/images/edit.gif" border="0" alt="Edit {$content[contentloop].name}" title="Edit {$content[contentloop].name}" /></a> - <a href="javascript:confirmDelete({$content[contentloop].id})">
        <img src="{$tempdir}admin/images/delete.gif" border="0" alt="Delete {$content[contentloop].name}" title="Delete {$content[contentloop].name}" /></a></td>
		<td class="text">{$content[contentloop].name}</td>
        <td class="text">{$content[contentloop].content|strip_tags|truncate:150}</td>
	  </tr>  
	{/section}
</table>
{else}
<div align="center">No Static Content</div>
{/if}
<div align="left"><input type="button" class="button" value="New Page" onclick="window.location='{$pagename}&amp;action=new';" /></div>
{elseif $action=="new"}
<form name="Content" method="post" action="{$editFormAction}">
  <table width="100%" border="0" cellspacing="0" cellpadding="4" align="center" class="content">
    <tr> 
      <th colspan="2" class="bighead">Content Admin</th>
    </tr>
    <tr valign="middle">
      <td align="right">Internal Name:</td>
      <td align="left"><input name="name" type="text" id="name" size="100" maxlength="100" class="inputbox" /></td>
    </tr>
    <tr valign="middle">
      <td align="right">Friendly Name:</td>
      <td align="left"><input name="fname" type="text" id="fname" size="100" maxlength="255" class="inputbox" /></td>
    </tr>
    <tr valign="middle"> 
	 <td valign="top" align="right">Content:</td>
      <td width="89%"> 
      <textarea id="editor" name="editor" style="width:100%; height:50em" class="inputbox"></textarea>	
	  </td>
    </tr>
    <tr valign="middle"> 
      <td colspan="2"> 
        <div align="center"> 
		  <input type="submit" name="Submit" value="Submit" class="button" />
        <input name="Cancel" type="button" id="Cancel" value="Cancel" onclick="window.location = '{$pagename}'" class="button" />
      </div>
      </td>
    </tr>
  </table>
</form>
{else}
<form name="Content" method="post" action="{$editFormAction}">
  <table width="100%" border="0" cellspacing="0" cellpadding="4" align="center" class="content">
    <tr> 
      <th class="bighead" colspan="2">Content for: {$name}</th>
    </tr>
    <tr valign="middle">
      <td align="right">Friendly Name:</td>
      <td align="left"><input name="fname" type="text" id="fname" size="100" maxlength="255" class="inputbox" value="{$contents.friendly}" /></td>
    </tr>
    <tr valign="middle"> 
      <td width="89%" colspan="2"> 
      <textarea id="editor" name="editor" style="width:100%; height:50em">{$Showcontent}</textarea>	     
	  </td>
    </tr>
    <tr valign="middle"> 
      <td class="text" colspan="2"> 
		  <input type="submit" name="Submit" value="Update" class="button" />
        <input name="Cancel" type="button" id="Cancel" value="Cancel" onclick="window.location = '{$pagename}'" class="button" />
      </td>
    </tr>
  </table>
</form>
{/if}
<div align="center">
 <a href="http://www.cmscout.za.net/index.php?page=subsite&amp;site=Manual&amp;content=adminpanel-staticcontent" target="_blank">Help</a>
</div>
